<?php

namespace app\common\behavior;

class Cors
{
    public function run()
    {
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Methods:*');
        header('Access-Control-Allow-Headers:*,Authorization');
        header('Access-Control-Allow-Credentials:false');
        if (request()->isOptions()) {
            $returnData['code'] = 0;
            $returnData['msg'] = lang('OPTIONS');
            response($returnData, 200, [], 'json')->send();
            exit();
        }
    }
}
